<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
	<script>
		var count0 = 1;
		count1 = 0;
		count2 = 0;
		while (count0 <= 3) {

			var num = "";
            while(!(num == '剪刀' || num == '布' ||num== '石头'))
			{var num = prompt('请输入石头剪刀布');}

			var com = Math.random() * 3 + 1;
			com1 = Math.floor(com);
			if (com1 == 1) {
				alert('电脑出石头');
			} else if (com1 == 2) {
				alert('电脑出剪刀');
			} else if (com1 == 3) {
				alert('电脑出布');
			} else {
				alert('000');
			}
			if (num == '石头' && com1 == 1) {
				alert('平局');
			} else if (num == '石头' && com1 == 2) {
				alert('哈哈我赢一分');
				count1++;
			} else if (num == '石头' && com1 == 3) {
				alert('电脑赢一分');
				count2++;
			} else {
				000
			}
			if (num == '剪刀' && com1 == 1) {
				alert('电脑赢一分');
				count2++;
			} else if (num == '剪刀' && com1 == 2) {
				alert('平局');
			} else if (num == '剪刀' && com1 == 3) {
				alert('哈哈我赢一分');
				count1++;
			} else {
				000
			}
			if (num == '布' && com1 == 1) {
				alert('哈哈我赢一分');
				count1++;
			} else if (num == '布' && com1 == 2) {
				alert('电脑赢一分');
				count2++;
			} else if (num == '布' && com1 == 3) {
				alert('平局');
			} else {
				000
			}
			count0++;
		}
		if (count1 > count2) {
			alert('哈哈我赢啦，嘻嘻！！！');
		} else if (count2 > count1) {
			alert('电脑最终获胜');
		} else if (count1 = count2) {
			alert('最后居然是平局！！！');
		}
	</script>
</body>
</html>